package com.fm.webrtc.message;

import org.json.JSONException;
import org.json.JSONObject;

public class CandidateMessage {
    private String candidate;
    private Integer sdpMLineIndex;
    private String sdpMid;

    public CandidateMessage(String candidate, Integer sdpMLineIndex, String sdpMid){
        this.candidate = candidate;
        this.sdpMLineIndex = sdpMLineIndex;
        this.sdpMid = sdpMid;
    }

    public String getCandidate() {
        return candidate;
    }

    public void setCandidate(String candidate) {
        this.candidate = candidate;
    }

    public Integer getSdpMLineIndex() {
        return sdpMLineIndex;
    }

    public void setSdpMLineIndex(Integer sdpMLineIndex) {
        this.sdpMLineIndex = sdpMLineIndex;
    }

    public String getSdpMid() {
        return sdpMid;
    }

    public void setSdpMid(String sdpMid) {
        this.sdpMid = sdpMid;
    }

    public JSONObject toJson() throws JSONException {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("candidate", candidate);
        jsonObject.put("sdpMLineIndex", sdpMLineIndex);
        jsonObject.put("sdpMid", sdpMid);
        return jsonObject;
    }

    @Override
    public String toString() {
        return "CandidateMessage{" +
                "candidate='" + candidate + '\'' +
                ", sdpMLineIndex=" + sdpMLineIndex +
                ", sdpMid='" + sdpMid + '\'' +
                '}';
    }
}
